package com.asl.website.core;

/**
 * @author 482944566@qq.com
 * @version 1.0
 * @date 2025-05-11
 */

public class JsonResult {
    private Integer status;
    private String message;
    private Object data;

    public static JsonResult ok(){
        return ok(null);
    }

    public static JsonResult ok(Object data){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setStatus(ServiceCode.OK.getStatus());
        jsonResult.setData(data);
        return jsonResult;
    }
    public static JsonResult fail(String mes){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setStatus(400);
        jsonResult.setMessage(mes);
        return jsonResult;
    }


    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
